<#import "macro.ftl" as m>
<@m.page_header title='添加金融资产' />
<div id="page-content-wrapper">
	<div id="page-title">
		<h3><a class="font-blue" href="/financialassets">金融资产</a> > 添加金融资产<h3>
	</div>
	<!-- #page-title -->
	<div id="page-content">
		<#if error??>
			<div class="infobox error-bg mrg20B">
                <p>${error}</p>
            </div>
		</#if>
		<form id="form" action="/financialassets" method="post">
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="name">名称：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="name" name="name" value="${financialAsset.name}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="financialAssetAmount">金额：</label>
		            </div>
		            <div class="form-input col-md-8">
					    <div class="input-append-wrapper input-append-right">
	                        <div class="input-append bg-gray">元</div>
	                        <div class="append-right">
	                            <input id="financialAssetAmount" name="amount" value="${financialAsset.amount}" data-required="true" data-rangelength="[1,45]" data-type="number" type="text">
		            		</div>
	                    </div>
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="valueDate">起息日：</label>
		            </div>
		            <div class="form-input col-md-8">
		                <input id="valueDate" name="valueDate" value="<#if financialAsset.valueDate??>${financialAsset.valueDate?string('yyyy-MM-dd')}</#if>" data-required="true" type="text" onclick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})">
		            </div>
		    	</div>
			</div>
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="dueDate">到期日：</label>
		            </div>
		            <div class="form-input col-md-8">
		                <input id="dueDate" name="dueDate" value="<#if financialAsset.valueDate??>${financialAsset.dueDate?string('yyyy-MM-dd')}</#if>" data-required="true" type="text" onclick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="publisher">发行商：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="publisher" name="publisher" value="${financialAsset.publisher}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="productForm">产品形式：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="productForm" name="productForm" value="${financialAsset.productForm}" data-required="true" data-rangelength="[1,255]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="underlyingAsset">基础资产：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="underlyingAsset" name="underlyingAsset" value="${financialAsset.underlyingAsset}" data-required="true" data-rangelength="[1,255]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="managementUnit">资产管理机构：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="managementUnit" name="managementUnit" value="${financialAsset.managementUnit}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="formingRoute">资产形成途径：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="formingRoute" name="formingRoute" value="${financialAsset.formingRoute}" data-required="true" data-rangelength="[1,255]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="legalOpinion">法律意见：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <textarea id="legalOpinion" name="legalOpinion" data-required="true" data-rangelength="[1,255]">${financialAsset.legalOpinion}</textarea>
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="adviceProvider">意见提供机构：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="adviceProvider" name="adviceProvider" value="${financialAsset.adviceProvider}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row mrg20T">
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="valuation">资产价值评估：</label>
		            </div>
		            <div class="form-input col-md-8">
					    <div class="input-append-wrapper input-append-right">
	                        <div class="input-append bg-gray">元</div>
	                        <div class="append-right">
	                            <input id="valuation" name="valuation" value="${financialAsset.valuation}" data-required="true" data-type="number" type="text">
	                        </div>
	                    </div>
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="valuationAgency">资产评估机构：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="valuationAgency" name="valuationAgency" value="${financialAsset.valuationAgency}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row mrg20T">
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="cashFlowAssessment">现金流测评：</label>
		            </div>
		            <div class="form-input col-md-8">
		            	<div class="input-append-wrapper input-append-right">
	                        <div class="input-append bg-gray">元</div>
	                        <div class="append-right">
	                            <input id="cashFlowAssessment" name="cashFlowAssessment" value="${financialAsset.cashFlowAssessment}" data-required="true" data-type="number" type="text">
	                        </div>
	                    </div>
		            </div>
		    	</div>
			</div>
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="cashFlowAssessmentResult">现金流测评结果：</label>
		            </div>
		            <div class="form-input col-md-8">
		                <select id="cashFlowAssessmentResult" name="cashFlowAssessmentResult">
	                        <option value="StableAndRule" <#if financialAsset.cashFlowAssessmentResult=="StableAndRule">selected</#if> >稳定且规则</option>
	                        <option value="StableButIrregular" <#if financialAsset.cashFlowAssessmentResult=="StableButIrregular">selected</#if> >稳定但不规则(需外部增信)</option>
	                        <option value="UnstableIrregular" <#if financialAsset.cashFlowAssessmentResult=="UnstableIrregular">selected</#if> >不稳定不规则（需外部增信）</option>
                        </select>
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="cashFlowAssessmentAgency">现金流测评机构：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="cashFlowAssessmentAgency" name="cashFlowAssessmentAgency" value="${financialAsset.cashFlowAssessmentAgency}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row mrg20T">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="measureToIncreaseTrust">增信措施：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="measureToIncreaseTrust" name="measureToIncreaseTrust" value="${financialAsset.measureToIncreaseTrust}" data-required="true" data-rangelength="[1,255]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="increaseTrustAgency">增信机构：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="increaseTrustAgency" name="increaseTrustAgency" value="${financialAsset.increaseTrustAgency}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		                <label for="riskRating">风险评级：</label>
		            </div>
		            <div class="form-input col-md-8">
		            	<select id="riskRating" name="riskRating">
	                        <option value="R1" <#if financialAsset.riskRating=="R1">selected</#if> >R1 谨慎型（基本无风险）</option>
	                        <option value="R2" <#if financialAsset.riskRating=="R2">selected</#if> >R2 稳健性型（风险超低）</option>
	                        <option value="R3" <#if financialAsset.riskRating=="R3">selected</#if> >R3 平衡型（风险低）</option>
	                        <option value="R4" <#if financialAsset.riskRating=="R4">selected</#if> >R4 进取型（风险中）</option>
	                        <option value="R5" <#if financialAsset.riskRating=="R5">selected</#if> >R5 激进型（风险高）</option>
                        </select>
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="riskAssessmentAgency">风险测评机构：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="riskAssessmentAgency" name="riskAssessmentAgency" value="${financialAsset.riskAssessmentAgency}" data-required="true" data-rangelength="[1,45]" type="text">
		            </div>
		    	</div>
			</div>
		</div>

        <div class="form-row">
            <div class="col-md-10">
                <div class="form-row">
                    <div class="form-label col-md-2">
                        <label for="">
                            协议模版:
                        </label>
                    </div>
                    <div class="form-input col-md-10">
                        <select id="templateSelect" name="protocolIds" multiple="" class="chosen-select">
                            <option value="">空模板</option>
                        <#list list as template>
                            <option value="${template.id}">${template.name}[${template.remark}]</option>
                        </#list>
                        </select>
                    </div>
                </div>
            </div>
        </div>

		<div class="row">
			<div class="col-md-10">
				<div class="form-row">
		            <div class="form-label col-md-2">
		                <label for="remark">备注：</label>
		            </div>
		            <div class="form-input col-md-10">
		                <input id="remark" name="remark" value="${financialAsset.remark}" data-rangelength="[1,255]" type="text">
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-5">
				<div class="form-row">
		            <div class="form-label col-md-4">
		            </div>
		            <div class="form-checkbox-radio col-md-8">
			            <input type="checkbox" name="disable" id="disable">
			            <label for="disable">停用</label>
		            </div>
		    	</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-10">
				<a href="javascript:;" class="btn large primary-bg radius-all-4 float-right" onclick="submit('form');">
		            <span class="button-content">保存</span>
                </a>
			</div>
		</div>
		</form>
	</div>
	<!-- #page-content -->
</div>
<!-- #page-content-wrapper -->
<script>

// 提交表单
function submit(formId){
	var valid = $('#' + formId).parsley( 'validate' );
	if(!valid){
		return;
	}
	
	$('#' + formId).submit();
}

</script>